﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Xtreme_Server
{
    class ConsoleWebServer
    {
        public WebServer s = new WebServer();
        public ConsoleWebServer(int port = 14550)
        {
            s.Port = port;
            s.LogSent += new WebServer.LogSentEventHandler(s_LogSent);
        }

        public void Start()
        {
            s.Start(s.Port);
        }

        public void s_LogSent(object sender, string log)
        {
            SendLog(log);
        }

        public void SendLog(string l)
        {
            Console.Write('[');
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("INFO");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("] ");
            Console.WriteLine(l);
        }

        public void Stop()
        {
            s.Stop();
        }
    }
}
